﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Web.Mvc;
using GWEB.WebBase.Data;
using GWEB.WebFrame.Public;
using Newtonsoft.Json;

namespace GWEB.WebFrame.Customer
{
    public class CreateController : PageInfoBase
    {       
        [ActionFilter(IsLogin = true)]
        public ActionResult Index(String id, String keyCode)
        {
            return Load("Create", "Customer/Create", id, keyCode);
        }
        protected override string Validate(Dictionary<string, object> data)
        {
            DataRow drUser = BasePage.GetUser(Session);
            data.Add("custState", 0);
            data.Add("createId",drUser["iuserid"].ToString());
            data.Add("createDate",DateTime.Now);
            data.Add("leagueId", drUser["leagueId"].ToString());
            if (data["custTel"].ToString().Length != 11)
                return "联系电话:必填且长度为11位";
            Dict dict= BasePage.getDict(Session);
            data.Add("custFrom", dict.GetValue2("D03", data["custFromId"].ToString()));
            return base.Validate(data);
        }
    }
}